﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SurveySystem.Master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="SurveySystem.Web.Default" %>

<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
    - Főoldal
</asp:Content>
<asp:Content ID="bodyContent" ContentPlaceHolderID="contentPlaceholder" runat="server">
    <br />
    <asp:LoginView ID="LoginView1" runat="server">
        <LoggedInTemplate>
            <h2>Kiírt szavazások</h2>
            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="4" AllowPaging="true"
                PageSize="5"
                DataSourceID="ObjectDataSource1" ForeColor="#333333" GridLines="None" OnRowDataBound="GridView2_RowDataBound">
                <EmptyDataTemplate>
                Nincsenek aktuális szavazások
                </EmptyDataTemplate>
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <Columns>
                    <asp:BoundField DataField="creator" HeaderText="Kérdező" SortExpression="creator" />
                    <asp:BoundField DataField="question" HeaderText="Kérdés" SortExpression="question" />
                    <asp:BoundField DataField="expirationTime" HeaderText="Lejárati idő" SortExpression="expirationTime" />
                    <asp:HyperLinkField DataNavigateUrlFields="id" DataNavigateUrlFormatString="~/ShowSurvey.aspx?surveyId={0}"
                        DataTextField="id" DataTextFormatString="Szavazok" NavigateUrl="~/ShowSurvey.aspx" />
                </Columns>
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OnSelecting="ObjectDataSource1_Selecting"
                SelectMethod="GetMyOpenSurveysPaged" 
                SelectCountMethod="GetMyOpenSurveysCount"
                TypeName="SurveySystem.Core.SurveysBLL" EnablePaging="true">
                <SelectParameters>
                    <asp:Parameter Name="userName" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
                SelectMethod="GetMyExpiredSurveysPaged" 
                SelectCountMethod="GetMyExpiredSurveysCount"

                TypeName="SurveySystem.Core.SurveysBLL" OnSelecting="ObjectDataSource2_Selecting" EnablePaging="true">
                <SelectParameters>
                    <asp:Parameter Name="userName" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <br />
            <h2>Lejárt szavazások</h2>
            <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" AllowPaging="true"
                PageSize="5"
                CellPadding="4" DataSourceID="ObjectDataSource2" ForeColor="#333333" GridLines="None"
                OnRowDataBound="GridView2_RowDataBound">
                <EmptyDataTemplate>Nincsenek lejárt szavazások</EmptyDataTemplate>
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />                
                <Columns>
                    <asp:BoundField DataField="creator" HeaderText="Kérdező" SortExpression="creator" />
                    <asp:BoundField DataField="question" HeaderText="Kérdés" SortExpression="question" />
                    <asp:BoundField DataField="expirationTime" HeaderText="Lejárati idő" SortExpression="expirationTime" />
                    <asp:HyperLinkField DataNavigateUrlFields="id" DataNavigateUrlFormatString="~/ShowSurvey.aspx?surveyId={0}"
                        DataTextField="id" DataTextFormatString="Megtekint" NavigateUrl="~/ShowSurvey.aspx" />
                </Columns>
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
        </LoggedInTemplate>
        <AnonymousTemplate>
        <h2>Az alkalmazás használatához be kell lépned!</h2>
        
        <asp:HyperLink ID="HyperLink_Registration" runat="server" NavigateUrl="~/Register.aspx">Regisztráció</asp:HyperLink>
        </AnonymousTemplate>
    </asp:LoginView>
    <br />
</asp:Content>
